#ifndef MAINWINDOWCONTROLLER_H
#define MAINWINDOWCONTROLLER_H

#include <QObject>
#include "chanmanager.h"

class MainWindow;
namespace Wishmaster
{
	class MainWindowController : public QObject
	{
		Q_OBJECT
	public:
		explicit MainWindowController(ChanManager* manager, MainWindow *parent);

		void setActiveChanIndex(int index);
		int activeChanIndex() const;
		Chan* activeChan() const;

		void setActiveBoardIndex(int index);
		int activeBoardIndex() const;
		Board* activeBoard() const;

		void setActiveThreadId(const ThreadId& threadId);
		ThreadId activeThreadId() const;

		void setCurrentPage(int page);
		int currentPage() const;


	signals:
		void boardListChanged(const QStringList& boardList);
		void threadListChanged();
		void threadActivated(const ThreadId& threadId);

	public slots:

	protected:
		virtual bool shouldBeRefreshed(Board* b);

	private:
		ChanManager* m_chanManager;
		MainWindow* m_window;
		int m_activeChanIndex;
		int m_activeBoardIndex;
		ThreadId m_activeThreadId;
		int m_currentPage;
	};
}

#endif // MAINWINDOWCONTROLLER_H
